package com.example.docmanagement.repository;

import com.example.docmanagement.entity.UserPermission;
import com.example.docmanagement.entity.UserPermission.UserPermissionId;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.UUID;

/**
 * 用户额外权限数据访问层
 */
@Repository
public interface UserPermissionRepository extends JpaRepository<UserPermission, UserPermissionId> {

    /**
     * 查询指定用户的额外权限
     */
    List<UserPermission> findByIdUserId(UUID userId);

    /**
     * 查询指定用户集合的额外权限
     */
    List<UserPermission> findByIdUserIdIn(Iterable<UUID> userIds);

    /**
     * 删除指定用户的全部额外权限
     */
    void deleteByIdUserId(UUID userId);
}


